package com.dbappsecurity.bifrost.view;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.dbappsecurity.bifrost.R;
import com.dbappsecurity.bifrost.base.InjectBaseActivity;
import com.dbappsecurity.network.Api;
import javax.inject.Inject;

public class MainActivity extends InjectBaseActivity {

  @Inject
  MainFragment mMainFragment;

  @Override
  protected int getLayout() {
    return R.layout.activity_main;
  }

  @Override
  protected void onViewCreated(Intent source,Bundle savedInstanceState) {
    super.onViewCreated(source, savedInstanceState);
    if (savedInstanceState != null) return;
    Bundle bundle = new Bundle();
    bundle.putString("url", source.getDataString());
    mMainFragment.setArguments(bundle);
    fragmentManager.get()
        .beginTransaction()
        .replace(R.id.container, mMainFragment)
        .commit();
  }

  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    mMainFragment.mJsBaseFragment.reload("http://www.baidu.com");
    Log.i("MainActivity", "Arirus onNewIntent: "+intent);
  }
}
